package com.hexorld.core;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;

import com.hexorld.utils.Coordinate;
import com.hexorld.utils.Position;

public abstract class HVisualObject extends HObject {
	public Coordinate coordinate;
	protected Bitmap mSrcBmp;
	protected Paint mPaint;
	protected Rect mDstRect;
	protected Context mContext;
	public HVisualObject(Context context){
		super();
		mContext = context;
		mPaint = new Paint();
		mDstRect = new Rect();
	}
	public HVisualObject(Context context, int width, int height, Position p){
		super(width, height, p);
		mContext = context;
		mPaint = new Paint();
		mDstRect = new Rect(p.x, p.y, p.x+width, p.y+height);
	}
	
	/*
	 * check if the point(x,y) is in this item area
	 */
	public boolean containsPoint(int x, int y) {
		return (x > getLeft() && x < getRight()
                && y > getTop() && y < getBottom());
	}
	
	public abstract void draw(Canvas canvas);
}
